#!/bin/sh

uci -q get system.@imm_init[0] > "/dev/null" || uci -q add system imm_init > "/dev/null"

if ! uci -q get system.@imm_init[0].lang > "/dev/null"; then
	uci -q batch <<-EOF
		set luci.main.lang="auto"
		commit luci

		set system.@imm_init[0].lang="1"
		commit system
	EOF
fi

ln -sf "/sbin/ip" "/usr/bin/ip"

sed -i "/log-facility/d" "/etc/dnsmasq.conf"
echo "log-facility=/dev/null" >> "/etc/dnsmasq.conf"

rm -rf "/tmp/luci-modulecache"
rm -f "/tmp/luci-indexcache"

[ -f '/etc/99-distfeeds.conf' ] && mv '/etc/99-distfeeds.conf' '/etc/opkg/distfeeds.conf'
sed -ri '/check_signature/s@^[^#]@#&@' /etc/opkg.conf

exit 0
